<?php
//按钮

namespace App\Models\Traits;


trait Btn
{
    public function editBtn(string $route){   //{{ route('admin.user.edit',$item)  }}
        //dd(request()->auths);
        if(auth()->user()->username != config('rbac.super') && !in_array($route,request()->auths)){
            return '';
        }
        return '<a href="'.route($route,$this).'" class="btn btn-secondary radius">修改</a>';
    }

    public function deleteBtn(string $route){   //{{ route('admin.user.edit',$item)  }}
        //dd(request()->auths);
        if(auth()->user()->username != config('rbac.super') && !in_array($route,request()->auths)){
            return '';
        }
        return '<a href="'.route($route,$this).'" class="btn btn-danger radius delbtn">删除</a>';  //btn btn-danger radius delbtn">删除</a>
    }

}
